library(recommenderlab)
library(stats)

DataTable <- read.table("ml-100k/u.data")

MovieLense <- as(DataTable, "realRatingMatrix")

MovieLense

rowc <- rowCounts(MovieLense)
median(rowc)

# RANDOM

schemaRND1 <- evaluationScheme(MovieLense, method="split", train=0.2, given=15, goodRating=4)
rRND1 <- Recommender(getData(schemaRND1, "train"), method = "RANDOM")

system.time(prRND1 <- predict(rRND1,getData(schemaRND1,"known"),type="ratings"))
error <- calcPredictionError(prRND1, getData(schemaRND1,"unknown"))

error
